﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using TFXK.BLL;
using TFXK.Common;
using log4net;
using TFXK.Model;

public partial class HotelInfo : System.Web.UI.Page
{
    private static readonly ILog log = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
    private static readonly CategoryBLL bllCategory = new CategoryBLL();
    private static readonly HotelBLL bllHotel = new HotelBLL();
    public Hotel modelTemp = new Hotel();
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            if (!IsPostBack)
            {
                if (string.IsNullOrEmpty(Request.QueryString["Key"] + ""))
                {
                    Response.Redirect("HotelList.aspx");
                }
                else
                {
                    int Key = int.Parse(Request.QueryString["Key"] + "");
                    InitData(Key);
                }
            }
        }
        catch (Exception ex)
        {
            log.Error(ex.Message);
        }
    }
    public void InitData(int Key)
    {
        modelTemp = bllHotel.GetModel(Key);
        this.Title += "-" + modelTemp.title;
        if (string.IsNullOrEmpty(modelTemp.imagePath))
        {
            modelTemp.imagePath = "images/nopic.jpg";
        }
        else
        {
            modelTemp.imagePath = "uploads/" + modelTemp.imagePath;
        }
    }
    public string GetPicWidth(object obj)
    {

        try
        {
            return int.Parse(obj + "") * 12 + "";
        }
        catch
        {
            return "0";
        }
    }
}